package com.tencent.common;

/**
 * User: rizenguo
 * Date: 2014/10/29
 * Time: 14:40
 * 这里放置各种配置数据
 */
public class Configure {
	public static String domain = "http://wx.tongguanedu.com";
	
	public static final int TOKEN_TIMEOUT = 7200;//微信全局token超时时间
	public static final int TICKET_TIMEOUT = 7200;//微信全局token超时时间

	//这个就是自己要保管好的私有Key了（切记只能放在自己的后台代码里，不能放在任何可能被看到源代码的客户端程序中）
	// 每次自己Post数据给API的时候都要用这个key来对所有字段进行签名，生成的签名会放在Sign这个字段，API收到Post数据的时候也会用同样的签名算法对Post过来的数据进行签名和验证
	// 收到API的返回的时候也要用这个key来对返回的数据算下签名，跟API的Sign数据进行比较，如果值不一致，有可能数据被第三方给篡改
	private static String key = "";

	//微信分配的公众号ID（开通公众号之后可以获取到）
	private static String appID = "wx3971ebf7a27f4e31";

	private static String appSecret = "9ec485bcd6bdc94d4b45dca45611c5e2";//
	
	//微信支付分配的商户号ID（开通公众号的微信支付功能之后可以获取到）
	private static String mchID = "";

	//受理模式下给子商户分配的子商户号
	private static String subMchID = "";

	//HTTPS证书的本地路径
	private static String certLocalPath = "cert/apiclient_cert.p12";
	
	//HTTPS证书密码，默认密码等于商户号MCHID
	private static String certPassword = "";

	//是否使用异步线程的方式来上报API测速，默认为异步模式
	private static boolean useThreadToDoReport = true;

	//机器IP
	private static String ip = "";
	
	//以下是微信支付API的路径：
	//1）被扫支付API
	public static final String MICRO_PAY_API = "https://api.mch.weixin.qq.com/pay/micropay";
	//2）查询订单,被扫支付查询API
	public static final String ORDER_QUERY_API = "https://api.mch.weixin.qq.com/pay/orderquery";
	//3）退款API//申请退款
	public static final String REFUND_API = "https://api.mch.weixin.qq.com/secapi/pay/refund";
	//4）退款查询API
	public static final String REFUND_QUERY_API = "https://api.mch.weixin.qq.com/pay/refundquery";
	//5）撤销API
	public static final String REVERSE_API = "https://api.mch.weixin.qq.com/secapi/pay/reverse";
	//6）下载对账单API
	public static final String DOWNLOAD_BILL_API = "https://api.mch.weixin.qq.com/pay/downloadbill";
	//7) 统计上报API
	public static final String REPORT_API = "https://api.mch.weixin.qq.com/payitil/report";
	//8)//统一下单
	public static final String UNIFIED_ORDER_API = "https://api.mch.weixin.qq.com/pay/unifiedorder";//统一下单
    //9)//关闭订单
    public static final String CLOSE_ORDER_API = "https://api.mch.weixin.qq.com/pay/closeorder";//关闭订单
    
    //以下是微信模板消息api路径：
    //1）设置所属行业
    public static final String SET_INDUSTRY_API = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN";
    //2）获取设置的行业信息
    public static final String GET_INDUSTRY_API = "https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN";
    //3）获得模板ID
    public static final String ADD_INDUSTRY_API = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN";
    //4）获取模板列表
    public static final String GET_ALL_PRIVATE_TEMPLATE_API = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN";
    //5）删除模板
    public static final String DEL_PRIVATE_TEMPLATE_API = "https://api,weixin.qq.com/cgi-bin/template/del_private_template?access_token=ACCESS_TOKEN";
    //6）发送模板消息
    public static final String TEMPLATE_SEND_API = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";

    //以下是微信权限相关的api地址
    //1）获取微信全局token
    public static final String TOKEN_API = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
    //2）获取微信全局token
    public static final String TICKET_API = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
    //3）获取微信登陆code
    public static final String AUTHORIZE_API = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
    //4）获取微信登陆token
    public static final String ACCESS_TOKEN_API = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
    
	public static String HttpsRequestClassName = "com.tencent.common.HttpsRequest";
	public static String HttpsRequest4MessageClassName = "com.tencent.common.HttpsRequest4Message";

	public static boolean isUseThreadToDoReport() {
		return useThreadToDoReport;
	}

	public static void setUseThreadToDoReport(boolean useThreadToDoReport) {
		Configure.useThreadToDoReport = useThreadToDoReport;
	}

	public static void setKey(String key) {
		Configure.key = key;
	}

	public static void setAppID(String appID) {
		Configure.appID = appID;
	}

	public static void setMchID(String mchID) {
		Configure.mchID = mchID;
	}

	public static void setSubMchID(String subMchID) {
		Configure.subMchID = subMchID;
	}

	public static void setCertLocalPath(String certLocalPath) {
		Configure.certLocalPath = certLocalPath;
	}

	public static void setCertPassword(String certPassword) {
		Configure.certPassword = certPassword;
	}

	public static void setIp(String ip) {
		Configure.ip = ip;
	}

	public static String getKey(){
		return key;
	}
	
	public static String getAppid(){
		return appID;
	}
	
	public static String getMchid(){
		return mchID;
	}

	public static String getSubMchid(){
		return subMchID;
	}
	
	public static String getCertLocalPath(){
		return certLocalPath;
	}
	
	public static String getCertPassword(){
		return certPassword;
	}

	public static String getIP(){
		return ip;
	}

	public static void setHttpsRequestClassName(String name){
		HttpsRequestClassName = name;
	}

	public static String getAppSecret() {
		return appSecret;
	}

	public static void setAppSecret(String appSecret) {
		Configure.appSecret = appSecret;
	}
}
